package routers

import (
	"gin_study_blog/api"
	"gin_study_blog/middleware"
)

func (r RouterGroup) ArticlesRouter() {
	articlesApi := api.ApiGroupApp.ArticlesApi
	// 添加
	r.POST("article", middleware.JwtAdminAuth(), articlesApi.ArticlesCreateView)
	// 列表
	r.GET("article", articlesApi.ArticleViewList)
	// 文章日历
	r.GET("article/calender", articlesApi.ArticleViewCalender)
	r.GET("article/:id", articlesApi.ArticleViewDetail)
	r.GET("article_tags", articlesApi.ArticleTagListView)
	r.PUT("article_modify", articlesApi.ArticleModifyView)
	// 移除文章
	r.DELETE("article", articlesApi.ArticleDeleteView)
	// 批量移除我收藏的文章
	r.DELETE("article/collects", middleware.JwtUserAuth(), middleware.JwtAdminAuth(), articlesApi.ArticleCollectsRemoveBatch)
	// 用户收藏列表
	r.GET("collects/list", middleware.JwtUserAuth(), middleware.JwtAdminAuth(), articlesApi.ArticleCollectListView)
	// 用户收藏或取消
	r.POST("article/collects", middleware.JwtUserAuth(), middleware.JwtAdminAuth(), articlesApi.ArticleCollectsCreateView)
	// 全文搜索
	r.GET("article/text", articlesApi.FullTextSearchView)
}
